﻿using System.Collections.Generic;
using System.Web.Mvc;
using WeBlog.Attributes;
using WeBlog.Resources;
using WeBlog.Services;

namespace WeBlog.Models
{
    public class SetupViewModel
    {        
        public SiteConfiguration Config { get; private set; }

        [WeBlogRequired]
        [EmailRegex]
        public string AdminEmail { get; set; }

        [WeBlogRequired]
        public string Password { get; set; }

        [WeBlogRequired]
        public string ConfirmPassword { get; set; }

        [WeBlogRequired]
        public int StorageOptionId { get; set; }

        public IEnumerable<SelectListItem> StorageOptions { get; private set; }

        public string SqlConnectionString { get; set; }

        public SetupViewModel()
        {
			Config = SiteManager.CurrentConfiguration;
            StorageOptions = new List<SelectListItem>()
            {
                new SelectListItem{ Text = Strings.StorageOption_SqlCompact, Value = Models.StorageOptions.SqlServerCompact.ToString(), Selected = true },
                new SelectListItem{ Text = Strings.StorageOption_SqlServer, Value = Models.StorageOptions.SqlServer.ToString()}
            };
        }
    }

    public static class StorageOptions
    {
        public const int SqlServerCompact = 1;
        public const int SqlServer = 2;
    }
}
